package cs5226.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import cs5226.model.SQLResultSet;

public class DebugInterfaceDAO {
	public static SQLResultSet execute(String query) throws SQLException {		
		Connection conn = DBUtil.getConnection();
		PreparedStatement stmt = conn.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE, 
				ResultSet.CONCUR_READ_ONLY);
		ResultSet rs = stmt.executeQuery();
		
		/**
		 * 
		 */
		SQLResultSet srs = new SQLResultSet();
		srs.populate(rs);
		
		DBUtil.close(rs, stmt, conn);
		
		/*
		while (rs.next()) {
			System.out.println (rs.getString(1));
		}
		*/
		
		return srs;
	}
	
}
